<%@ page language="java" contentType="text/html; charset=utf8"
	pageEncoding="utf8"%>
<%@ taglib uri="http://jsptags.com/tags/navigation/pager" prefix="pg" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
	+ request.getServerName() + ":" + request.getServerPort()
	+ path + "/";
%>

<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath%>" />

<link rel="stylesheet" href="css/bootstrap.min.css" type="text/css" />
<script type="text/javascript" src="js/bootstrap.js"></script>
<script type="text/javascript">
	function check(url){
		if (confirm("确认删除吗?")){
			window.location.href=url;
		}
		
	}
</script>
<link rel="stylesheet"
	href="font-awesome-4.7.0/css/font-awesome.css" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
<title></title>
</head>
<body>
	<%@ include file="/adminHeader.jsp" %>

	<div class="container">

		
		<table class="table table-hover table-striped">
			<tr>
				<th class="text-center">书名</th>
				<th class="text-center">作者</th>
				<th class="text-center">操作</th>

			</tr>

			<c:forEach items="${requestScope.books}" var="book">	
			
			<tr class="text-center">
				<td class="text-center">${book.title }</td>
				<td class="text-center">${book.authorName}</td>
				<td class="text-center"><a href="bookManager/get?bookId=${book.id}&authorName=${book.authorName}">修改</a>
				<a href="javascript:void(0)" onclick="check('bookManager/delete?bookId=${book.id}')">删除</a></td>
			</tr>
			
			</c:forEach>			
		
		</table>
		<ul class="page row text-center">
				<pg:pager url="bookManager/list"
					items="${requestScope.total}" export="currentPageNumber=pageNumber"
					maxPageItems="${param.pageSize}" maxIndexPages="4">
					<pg:param name="condition" value="${param.condition}" />
					<pg:param name="pageSize" value="${param.pageSize}" />
					<pg:first>
						<li class="page-item"><a class="page-link" href="${pageUrl}"
							class="page">首页</a></li>
					</pg:first>
					<pg:prev>
						<li class="page-item"><a class="page-link" href="${pageUrl}"
							class="page">«</a></li>
					</pg:prev>
					<pg:pages>
						<c:choose>
							<c:when test="${currentPageNumber eq pageNumber}">
								<li class="page-item active"><a class="page-link" href="#">${pageNumber}</a></li>
							</c:when>
							<c:otherwise>
								<li class="page-item"><a class="page-link"
									href="${pageUrl }">${pageNumber }</a></li>
							</c:otherwise>
						</c:choose>
					</pg:pages>
					<pg:next>
						<li class="page-item"><a class="page-link" href="${pageUrl }"
							class="page">»</a></li>
					</pg:next>
					<pg:last>
						<li class="page-item"><a class="page-link" href="${pageUrl }"
							class="page">尾页</a></li>
					</pg:last>
				</pg:pager>
			</ul>
	</div>

</body>
</html>